package jd.se.admin.BookControl;

import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface BookDao {
    @Select("select * from book where status = 2")
    List<Book> findBookList();

    @Update("update book set status=0 where b_id=#{b_id}")
    void acceptBook(String b_id);

    @Insert("insert into book(b_id,b_name,author,press,lender,cover,status) values(#{b_id},#{b_name},#{author},#{press},#{lender},#{cover},0)")
    void addBook(BookDto b);

    @Delete("delete from book where b_id = #{b_id}")
    void deleteBook(String b_id);

    @Select("select count(*) from borrow where b_id=#{b_id}")
    int is_borrowed(String b_id);

    @Select("select * from book where b_id=#{b_id}")
    List<Book> searchBook(String b_id);
    

}
